package com.nbsaas.boot.solution.rest.resource;

import com.nbsaas.boot.solution.api.apis.SolutionApi;
import com.nbsaas.boot.solution.data.entity.Solution;
import com.nbsaas.boot.solution.api.domain.request.SolutionRequest;
import com.nbsaas.boot.solution.api.domain.response.SolutionResponse;
import com.nbsaas.boot.solution.api.domain.simple.SolutionSimple;
import com.nbsaas.boot.solution.rest.convert.SolutionSimpleConvert;
import com.nbsaas.boot.solution.rest.convert.SolutionEntityConvert;
import com.nbsaas.boot.solution.rest.convert.SolutionResponseConvert;
import com.nbsaas.boot.solution.data.repository.SolutionRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   解决方案-业务接口实现
*/
@Transactional
@Service
public class SolutionResource extends BaseResource<Solution,SolutionResponse, SolutionSimple, SolutionRequest>  implements SolutionApi {

    @Resource
    private SolutionRepository solutionRepository;

    @Override
    public JpaRepositoryImplementation<Solution, Serializable> getJpaRepository() {
        return solutionRepository;
    }

    @Override
    public Function<Solution, SolutionSimple> getConvertSimple() {
        return new SolutionSimpleConvert();
    }

    @Override
    public Function<SolutionRequest, Solution> getConvertForm() {
        return new SolutionEntityConvert();
    }

    @Override
    public Function<Solution, SolutionResponse> getConvertResponse() {
        return new SolutionResponseConvert();
    }




}


